package config;

import java.sql.Connection;
import java.sql.DriverManager;

public class MyConfig {
    public Connection getConnection() throws Exception {
        System.out.println("配置类@Bean给容器中添加组件了...");
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/tedu?useUnicode=true&characterEncoding=utf8&serverTimeZone=Asia/Shanghai";
        String username = "root";
        String password = "root";
        Connection conn = DriverManager.getConnection(url, username, password);
        return conn;
    }
}
